package main

import (
	"fmt"
	"sync"
)

var w sync.WaitGroup

func work(i int, once *sync.Once) {
	defer w.Done()
	once.Do(func(){
		fmt.Println("do once at", i)
	})
}

func main() {
	var once sync.Once

	for i:=0; i<10; i++ {
		w.Add(1)
		go work(i, &once)
	}

	w.Wait()
}
